﻿using Huirui.Cavan.Domain.Seedwork;
using System;
using System.Collections;

namespace Huirui.Cavan.Domain.MainBoundedContext.SystemModule
{
    #region BaseCodeRule

    /// <summary>
    /// BaseCodeRule object for NHibernate mapped table 'BaseCodeRule'.
    /// </summary>
    [Serializable]
    public class BaseCodeRule : Persistent
    {
        #region Member Variables

        protected string _name;
        protected SystemIdentifier.BaseCodeRuleType _type;
        protected string _prefix;
        protected bool _isDefault;
        protected int _serialNumberNumber;
        protected int _serialNumberStart;
        protected string _example;
        protected Corporation _corporation;

        #endregion

        #region Constructors

        public BaseCodeRule() { }

        public BaseCodeRule(string name, SystemIdentifier.BaseCodeRuleType type, string prefix, bool isDefault, int serialNumberNumber, int serialNumberStart, string sample, DateTime createDate, DateTime modifyDate, int editUser, Corporation corporation)
        {
            this._name = name;
            this._type = type;
            this._prefix = prefix;
            this._isDefault = isDefault;
            this._serialNumberNumber = serialNumberNumber;
            this._serialNumberStart = serialNumberStart;
            this._example = sample;
            this._createDate = createDate;
            this._modifyDate = modifyDate;
            this._editUser = editUser;
            this._corporation = corporation;
        }

        #endregion

        #region Public Properties

        public virtual string Name
        {
            get { return _name; }
            set
            {
                if (value != null && value.Length > 20)
                    throw new ArgumentOutOfRangeException("Invalid value for Name", value, value.ToString());
                _name = value;
            }
        }

        public virtual SystemIdentifier.BaseCodeRuleType Type
        {
            get { return _type; }
            set { _type = value; }
        }

        public virtual string Prefix
        {
            get { return _prefix; }
            set
            {
                if (value != null && value.Length > 10)
                    throw new ArgumentOutOfRangeException("Invalid value for Prefix", value, value.ToString());
                _prefix = value;
            }
        }

        public virtual bool IsDefault
        {
            get { return _isDefault; }
            set { _isDefault = value; }
        }

        public virtual int SerialNumberNumber
        {
            get { return _serialNumberNumber; }
            set { _serialNumberNumber = value; }
        }

        public virtual int SerialNumberStart
        {
            get { return _serialNumberStart; }
            set { _serialNumberStart = value; }
        }

        public virtual string Example
        {
            get { return _example; }
            set { _example = value; }
        }

        public virtual Corporation Corporation
        {
            get { return _corporation; }
            set { _corporation = value; }
        }



        #endregion
    }
    #endregion
}